package com.Servlet;

import java.io.IOException;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



import com.contract.sql.getPerson;

/**
 * Servlet implementation class getPersonInf
 */
@WebServlet("/getPersonInf")
public class getPersonInf extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public getPersonInf() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		  getPerson getP=new getPerson();
		   String school=null;
		   String result[]=new String[9];
		   String name=null;
			String qq=null;
			String wechat=null;
			String youbian=null;
			String mobilephone=null;
			String email=null;
			String unit=null;
			String adress=null;
			String hometel=null;
			String unittel=null;
			String position=null;
		   String username=(String) request.getSession().getAttribute("username");
		 result= getP.getPersonInfor(username);
		 name=result[1];
		 school=result[0];
		 qq=result[2];
		 wechat=result[3];
		 youbian=result[4];
		 mobilephone=result[5];
		 email=result[6];
		 unit=result[7];
		 adress=result[8];
		 hometel=result[9];
		 unittel=result[10];
		 position=result[11];
		 
		 request.setAttribute("name", name);
		 request.setAttribute("school", school);
		 request.setAttribute("qq", qq);
		 request.setAttribute("wechat", wechat);
		 request.setAttribute("youbian", youbian);
		 request.setAttribute("mobilephone", mobilephone);
		 request.setAttribute("email", email);
		 request.setAttribute("unit", unit);
		 request.setAttribute("adress", adress);
		 request.setAttribute("hometel", hometel);
		 request.setAttribute("unittel", unittel);
		 request.setAttribute("position", position);
		  request.getRequestDispatcher("/userinfor.jsp").forward(request, response);
		
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		doGet(request, response);
	}

}
